Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug Enso language in ChromeDev tools with --inspect option #3432

Merged
merged 13 commits into from
May 10, 2022

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented May 5, 2022

Pull Request Description

Finally this pull request proposes --inspect option to allow debugging of .enso in Chrome Developer Tools:

enso$ ./built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/enso --inspect --run ./test/Tests/src/Data/Numbers_Spec.enso 
Debugger listening on ws://127.0.0.1:9229/Wugyrg9Nm4OUL9YhzdcElmLft71ayZW3LMUPCdPyNAY
For help, see: https://www.graalvm.org/tools/chrome-debugger
E.g. in Chrome open: devtools://devtools/bundled/js_app.html?ws=127.0.0.1:9229/Wugyrg9Nm4OUL9YhzdcElmLft71ayZW3LMUPCdPyNAY

copy the printed URL into chrome browser and you should see:

obrazek

One can also debug the .enso files in NetBeans or VS Code with Apache Language Server extension just pass in special JVM arguments:

enso$ JAVA_OPTS=-agentlib:jdwp=transport=dt_socket,server=y,address=8000 ./built-distribution/enso-engine-0.0.0-dev-linux-amd64/enso-0.0.0-dev/bin/enso --run ./test/Tests/src/Data/Numbers_Spec.enso
Listening for transport dt_socket at address: 8000

and then Debug/Attach Debugger. Once connected choose the Toggle Pause in GraalVM Script button in the toolbar (the "G" button):

obrazek

and your execution shall stop on the next .enso line of code. This mode allows to debug both - the Enso code as well as Java code.

Originally started as an attempt to write test in Java:

  • test written in Java
  • support for JUnit in build.sbt
  • compile Java with -g - so it can be debugged
  • Implementation of StatementNode - only gets created when materialize request gets to BlockNode

Important Notes

Checklist

Please include the following checklist in your PR:

  • [ x ] The documentation has been updated if necessary.
  • [ x ] All code conforms to the Scala, Java, and Rust style guides.
  • All code has been tested:
    • [ x ] Unit tests have been written where possible.

@JaroslavTulach JaroslavTulach requested a review from 4e6 as a code owner May 5, 2022 11:19
@JaroslavTulach JaroslavTulach self-assigned this May 5, 2022
Copy link
Contributor

@kustosz kustosz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So glad we can do this!

@JaroslavTulach
Copy link
Member Author

Expanded the test to startDebugging session and modified BlockNode to wrap its children as StatementNode when debugger is connected. Now it is possible to debug .enso files in NetBeans, VSCode, Chrome Dev tools, etc.:

obrazek

@JaroslavTulach JaroslavTulach changed the title Writing test in modern Java with text block Testing debugging capabilities of Enso engine in Java with text blocks May 5, 2022
@JaroslavTulach JaroslavTulach requested a review from kustosz May 6, 2022 04:33
Copy link
Contributor

@kustosz kustosz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice and elegant! Minor comment inline.

build.sbt Show resolved Hide resolved
build.sbt Outdated Show resolved Hide resolved
@JaroslavTulach JaroslavTulach requested a review from jdunkerley May 7, 2022 02:45
@JaroslavTulach
Copy link
Member Author

Request: put the documentation on debugging into the docs folder!

@JaroslavTulach JaroslavTulach changed the title Testing debugging capabilities of Enso engine in Java with text blocks Debug Enso language in ChromeDev tools with --inspect option May 10, 2022
@4e6 4e6 added the CI: Ready to merge This PR is eligible for automatic merge label May 10, 2022
@mergify mergify bot merged commit 21c4690 into develop May 10, 2022
@mergify mergify bot deleted the wip/jtulach/TestsInJava18-181988063 branch May 10, 2022 08:55
@JaroslavTulach
Copy link
Member Author

Thank you for polishing the documentation and merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants